package com.xiaozhichao.javaapi.base.extend;
import com.xiaozhichao.javaapi.base.extend.inner.ChildrenInner;
import org.junit.Assert;
import org.junit.Test;

/**
 * 继承测试
 */
public class ExtendTest {

    /**
     * 成员变量访问权限测试
     * public 不限访问权限
     * default 包访问权限
     * protected 包访问权限 + 派生访问权限
     * private 自有类访问权限
     */
    @Test
    public void testMemberPermission(){
        Children children = new Children();
        Assert.assertNotNull(children.defaultBaseStr);
        Assert.assertNotNull(children.protectedBaseStr);
        Assert.assertNotNull(children.publicBaseStr);

        Assert.assertNotNull(children.defaultStr);
        Assert.assertNotNull(children.protectedStr);
        Assert.assertNotNull(children.publicStr);

        System.out.println("========================");

        ChildrenInner childrenInner = new ChildrenInner();
        Assert.assertNotNull(childrenInner.protectedBaseStr);
        Assert.assertNotNull(childrenInner.publicBaseStr);

        Assert.assertNotNull(childrenInner.publicInnerStr);
    }
}
